/*
 * This datastructure coordinates thesonglist.
 * Therefore it is responsible for the next and last songas well as adding new songs to the list and delete them.
 */

package openmusicplayer;

import java.applet.*;
import java.applet.AudioClip;
import java.io.File;
import java.net.*;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
import javax.print.DocFlavor.URL;

/**
 *
 * @author postmanisonline
 */
public class songListDataStructure
{
    //list of important songs for the moment
    private String actualSong;
    private String previewsSong;
    private String nextSong;
    private Vector <String> songVector;

    /*
     *<editor-fold defaultstate="collapsed" desc="get methods">
     */
    public String getActualSong()
    {
        return this.actualSong;
    }

    public String getPreviewsSong()
    {
        return this.previewsSong;
    }

    public String getNextSong()
    {
        return this.nextSong;
    }

    public Vector <String> getSongList()
    {
        return this.songVector;
    }
    //</editor-fold>

    /*
     * <editor-fold defaultstate="collapsed" desc="set methods">
     */
    public void setActualSong(String selectedSong)
    {
        this.actualSong = selectedSong;
    }

    public void setPreviewsSong(String previewsSong)
    {
        this.previewsSong = previewsSong;
    }

    public void setNextSong(String nextSong)
    {
        this.nextSong = nextSong;
    }

    public void setSongVector(File[] songList)
    {

        for(int i=0; i<songList.length; i++)
        {
            songVector.add(songList[i].getAbsolutePath().toString());
        }
    }
    //</editor-fold>

    public void deleteSongList()
    {
        this.actualSong = null;
        this.nextSong = null;
        this.previewsSong = null;
        this.songVector.clear();
    }

    /*
     * <editor-fold defaultstate="collapsed" desc="constructor">
     */
    public songListDataStructure()
    {
        this.actualSong = null;
        this.previewsSong = null;
        this.nextSong = null;
        this.songVector = new Vector();
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="playing method">
    public void playSong(String fileAddress)
    {
            URL songFile = new URL(fileAddress);
            AudioClip clip = new AudioClipImpl(songFile);
            clip.play();
    }

    private static class AudioClipImpl implements AudioClip
    {

        public AudioClipImpl()
        {
        }

        private AudioClipImpl(URL songFile)
        {
            throw new UnsupportedOperationException("Not yet implemented");
        }

        public void play()
        {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void loop()
        {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public void stop()
        {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }
    //<editor-fold>
}
